package com.example.dem8;

/**
 * @program: xian-cheng
 * @description:
 * @author: 诸葛龙辰
 * @create: 2022-11-01 20:06
 **/

public class TestCat {
    public static void main(String[] args) throws InterruptedException{
        CatDemo c1 = new CatDemo();
        c1.start();
        CatDemo c2 = new CatDemo();
        c2.start();
        //main允许t1下加入，只有t1线程执行完毕后主线程才会执行。
        c1.join();
        c2.join();
        for (int i = 0; i < 20; i++) {
            System.out.println("main===============" + i);
        }

    }
}
class CatDemo extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 20; i++) {
            System.out.println(Thread.currentThread().getName() + "~~~~~~~~~~~~~" + i);
        }
    }

}
